<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
	<title>Cadastro de Rotas</title>
</h:head>
<h:body>
	<h:form id="rota">
		<p:growl id="confirmaEmpresa" />
		<p:fieldset legend="Rota">
			<font style="font-size: 12; ">
			<h:outputText value="Localizar empresas parceiras:"  />
			</font>
			<fieldset>
			<h:panelGrid columns="1">
			
			<h:outputLabel value="Digite o CNPJ:" style="color:red;"/>
			
			<h:panelGrid columns="2">
				
				<p:inputMask id="pesquisarCnpj" mask="99.999.999/9999-99"
					value="#{rotaAction.status}" size="15" />

				<p:commandButton id="procurarEmpresa" ajax="false" value="Pesquisar"
					actionListener="#{rotaAction.localizarEmpresaStatus}"
					update="confirmaEmpresa" />
					
					
			</h:panelGrid>
</h:panelGrid>
</fieldset>
			<h:panelGrid columns="1">
				<h:outputLabel value="Cidade:" rendered="#{rotaAction.botao}"/>
				<h:outputText value="#{rotaAction.empresa.endereco.cidade}" rendered="#{rotaAction.botao}"/>
				<h:outputLabel value="Descrição:" rendered="#{rotaAction.botao}"/>
				<p:inputText value="#{rotaAction.rota.descricao}"  rendered="#{rotaAction.botao}"/>

			<p:commandButton title="Salvar Rota" value="Salvar" actionListener="#{rotaAction.salvarRota}" update="confirmaEmpresa" onclick="telaCadas.show()"/>

			</h:panelGrid>


		</p:fieldset>
	
<p:dialog id="telaConfirmacaoCadastro" rendered="#{rotaAction.cadastrarRota}" widgetVar="telaCadas" width="250" height="120"
			header="Rota cadastrada" resizable="false" modal="true">

<h:outputLabel value="Dados armazenados com sucesso!" style="color:blue;"/>
<h:panelGrid  cellspacing="15"  >
<p:commandButton  value="Ok" actionListener="#{rotaAction.redirecionePaginaCadastro}" oncomplete="telaCadas.hide()"/>


</h:panelGrid>


</p:dialog>



	</h:form>

</h:body>


</html>